<template>
	<view class="waterfall-item" @tap="onTap">
		<image class="waterfall-item-img noSaveImg" :src="params.auctionImg" mode="widthFix" @load="emitHeight" @error="emitHeight"></image>
		<view class="content">
			<view class="content-title multi-line">{{params.auctionName}}</view>
			<!-- <view class="content-infoMoney">
				<text class="content-infoMoney-item">起拍:￥{{params.startMoney}}</text>
				<text class="content-infoMoney-item">一口价:￥{{params.oneMoney}}</text>
			</view> -->
			<view class="content-money">当前报价：<text class="content-money-text">￥{{params.currentPrice}}</text></view>
			<view class="content-time">预计{{endTimeFunc(params.auctionEndTime)}}结束</view>
		</view>
	</view>
</template>

<script>
	export default {
		name:"helang-waterfall",
		props:{
			params:{
				type: Object,
				default(){
					return {}
				}
			},
			tag:{
				type:String | Number,
				default:''
			},
			index:{
				type:Number,
				default:-1
			}
		},
		data() {
			return {
				
			};
		},
		computed:{
			endTimeFunc() {
				return function(e) {
					if (e) {
						let eArr = e.split('-');
						// console.log(eArr)
						let m = eArr[1]; // 月
						let _eArr = eArr[2].split(' ');
						let d = _eArr[0]; // 日
						let __eArr = _eArr[1].split(':');
						let h = __eArr[0]+':'+__eArr[1];
						return m+'月'+d+'日'+h;
					} else {
						return '暂无时间'
					}
				}
			}
		},
		methods:{
			// 发出组件高度信息，在此处可以区分正确和错误的加载，给予错误的提示图片
			emitHeight(e){
				const query = uni.createSelectorQuery().in(this);
				query.select('.waterfall-item').boundingClientRect(data => {
					let height = Math.floor(data.height);
					this.$emit("height",height,this.$props.tag);
				}).exec();
			},
			onTap(){
				this.$emit("click",this.$props.params);
			}
		}
	}
</script>

<style lang="scss" scoped>
.waterfall-item{
	width: 332rpx;
	padding: 16rpx;
	box-sizing: border-box;
	background-color: #16181D;
	border-radius: 20px;
	font-size: 28rpx;
	color: #666;
	margin-bottom: 20rpx;
	border: 1px solid #282a2f;
	// width: 332px;
	// height: 602px;
	// background: #181A20;
	// border-radius: 40px;
	// border: 4px solid;
	// border-image: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0)) 4 4;
	.waterfall-item-img{
		display: block;
		width: 100%;
		// 默认设置一个图片的大约值
		height: 350rpx;
		border-radius: 20rpx;
	}
	
	.content{
		margin-top: 16rpx;
		padding: 0 10rpx;
		box-sizing: border-box;
		.content-title{
			font-size: 28rpx;
			color: #cccccc;
			text-align: center;
		}
		.content-infoMoney{
			display: flex;
			flex-wrap: wrap;
			justify-content: space-between;
			margin-top: 16rpx;
			.content-infoMoney-item{
				padding: 6rpx 6rpx;
				box-sizing: border-box;
				border-radius: 40rpx;
				font-size: 24rpx;
				-webkit-transform:scale(0.72);
				color:rgba(255, 255, 255, 0.5);
				background: linear-gradient(223deg, #A339D8 0%, #6948F2 100%);
			}
		}
		.content-money{
			color: #A06AF9;
			font-size: 24rpx;
			margin-top: 24rpx;
			.content-money-text{
				font-size: 36rpx;
				font-weight: 700;
			}
		}
		.content-time{
			font-size: 24rpx;
			color: rgba(255,255,255,0.4);
			margin-top: 8rpx;
		}
	}
}
</style>
